﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_BBSISBoardMaster]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_BBSISBoardMaster];
GO
CREATE PROCEDURE [dbo].[sproc_BBSISBoardMaster]
    @board_id int,
    @staff_name nvarchar(50)
/*

===========================================================
功能:    判断用户是否是某版块的版主
参数:
    @board_id int            :    版块ID
    @staff_name nvarchar(50)    :    用户名

===========================================================

*/
AS
IF EXISTS(SELECT 1 FROM uds_bbs_boardmaster 
            WHERE     board_id =@board_id AND 
                staff_id =(SELECT staff_id 
                            FROM uds_staff 
                            WHERE staff_name = @staff_name
                       ))
BEGIN
    SELECT 1
    RETURN 1
END
ELSE
BEGIN
    SELECT 0
    RETURN 0
END